//
//  NextViewController.m
//  LockTest
//
//  Created by ZhangBo on 2018/12/11.
//  Copyright © 2018 ZhangBo. All rights reserved.
//

#import "NextViewController.h"
#import <ReactiveObjC/ReactiveObjC.h>

@interface NextViewController ()
@property (nonatomic, strong)RACSignal * signal;
@end

@implementation NextViewController

//对象被释放!!
- (void)dealloc {
    NSLog(@"这个控制器走了!不送!!");
    MHDealloc;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor colorWithWhite:0.5 alpha:0.5];
    @weakify(self);
    RACSignal * signal = [RACSignal createSignal:^RACDisposable * _Nullable(id<RACSubscriber>  _Nonnull subscriber) {
        @strongify(self);
        NSLog(@"%@",self);
        [subscriber sendNext:@"发送数据"];
        [self dismissViewControllerAnimated:YES completion:nil];
        return  nil;
    }];
    
    _signal = signal;
}

- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
    
    [_signal subscribeNext:^(id  _Nullable x) {
        NSLog(@"label:%@",x);
    }];

}

@end
